package com.whity.towerdefense.model;

public class CellType
{
	// =============================================================
	// Protected attributs
	
	protected final boolean 	m_Walkable;
	protected final boolean 	m_Buildable;
	protected final boolean 	m_Spawnable;
	protected final boolean		m_Objectif;
	
	// =============================================================
	// Public functions
	
	public CellType(boolean p_Walkable, boolean p_Buildable, boolean p_Spawnable, boolean p_Objectif) throws ParsingException
	{
		m_Walkable 	= p_Walkable;
		m_Buildable = p_Buildable;
		m_Spawnable = p_Spawnable;
		m_Objectif 	= p_Objectif;
		
		// Consistency check
		if(m_Spawnable && !m_Walkable)
		{
			throw(new ParsingException("CellType can't be : Spawnable and not Walkable"));
		}
		if(m_Objectif && m_Buildable)
		{
			throw(new ParsingException("CellType can't be : Objectif and Buildable"));
		}
		if(m_Objectif && !m_Walkable)
		{
			throw(new ParsingException("CellType can't be : Objectif and not Walkable"));
		}
		if(m_Objectif && m_Spawnable)
		{
			throw(new ParsingException("CellType can't be : Objectif and Spawnable"));
		}
		if(m_Spawnable && m_Buildable)
		{
			throw(new ParsingException("CellType can't be : Spawnable and Buildable"));
		}
	}
	
	// =============================================================
}
